package com.xin.di.uav.operate.rest;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xin.di.uav.common.request.operate.PlacementPointReq;
import com.xin.di.uav.common.response.operational.PlacementPointRes;
import com.xin.di.uav.common.utils.RespJsonPageData;
import com.xin.di.uav.common.utils.Rs;
import com.xin.di.uav.operate.po.PlacementPoint;
import com.xin.di.uav.operate.service.IPlacementPointService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author lixiang
 * @since 2023-09-12
 */
@RestController
@RequiredArgsConstructor
public class PlacementPointRest {

    private final IPlacementPointService iPlacementPointService;

    @GetMapping("select-by-id")
    public PlacementPoint selectById(String id) {
        return iPlacementPointService.selectById(id);
    }

    public RespJsonPageData<PlacementPointRes> getPagePlacementPoint(PlacementPointReq placementPointReq) {
        return iPlacementPointService.getPagePlacementPoint(placementPointReq);
    }

    public Rs<Integer> addPlacementPoint(PlacementPointReq placementPointReq) {
        return iPlacementPointService.addPlacementPoint(placementPointReq);
    }

    public Rs<Integer> editPlacementPoint(PlacementPointReq placementPointReq) {
        return iPlacementPointService.updateById(placementPointReq);
    }

    public Rs<Integer> delPlacementPoint(PlacementPointReq placementPointReq) {
        return iPlacementPointService.deletedPlacementPoint(placementPointReq);
    }

    public PlacementPoint getPlacementPointById(String id){
        return iPlacementPointService.getById(id);
    }

    public List<PlacementPoint> getPlacementPointList(String scenicSpotId){
        return iPlacementPointService.list(new QueryWrapper<PlacementPoint>().eq("scenic_spot_id", scenicSpotId));
    }
    public List<PlacementPoint> getPlacementPointListByScenicSpotIds(List<String> scenicSpotIds){
        return iPlacementPointService.list(new QueryWrapper<PlacementPoint>().in("scenic_spot_id", scenicSpotIds));
    }

    public List<PlacementPoint> getPlacementPointListByIds(Set<String> ids){
        return iPlacementPointService.listByIds(ids);
    }

    public PlacementPoint selectByIdNoByStatus(String id) {
        return iPlacementPointService.getById(id);
    }
}
